
//
//  LPRequestParser.m
//  DigitalSchool
//
//  Created by Pan on 2017/10/24.
//  Copyright © 2017年 Pan. All rights reserved.
//

#import "LPRequestParser.h"
#import "LPShareManager.h"
#import "pch.h"



@implementation LPRequestParser



//获取启动图
+(void)getImageUrlBlock:(void (^)(id, NSError *))block{
    [[LPShareManager shareManager]GET:ImageUrl dict:nil succeed:^(id responseObject) {
        block(responseObject,nil);
    } failure:^(NSError *error) {
        block(nil,error);
    }];
}

//登录接口    // 15110236190     YL8888
+(void)postLoginAppUserName:(NSString *)userName securityCode:(NSString *)securiytcode url:(NSString *)url block:(void (^)(id, NSError *))block{
    NSDictionary * dic = [NSDictionary dictionaryWithObjectsAndKeys:userName,@"uname",securiytcode,@"security_code", nil];
    [[LPShareManager shareManager]POST:url dict:dic succeed:^(id responseObject) {
        block(responseObject,nil);
    } failure:^(NSError *error) {
        block(nil,error);
    }];
}

+(void)postOwnpaperAttachedFatherId:(NSInteger) fatherid url:(NSString *)url UserName:(NSString *)userName securityCode:(NSString *)securiytcode block:(void (^)(id responseObject, NSError *error))block{
    NSDictionary * dic = [NSDictionary dictionaryWithObjectsAndKeys:@(fatherid),@"father_id",userName,@"uname",securiytcode,@"security_code",nil];
    [[LPShareManager shareManager] POST:url dict:dic succeed:^(id responseObject) {
        block(responseObject,nil);
    } failure:^(NSError *error) {
        block(nil,error);
    }];
}

+(void)postSaveOwnpaperAppUname:(NSString *)uname url:(NSString *)url SecurityCode:(NSString *)securiycode Point_time:(NSString *)pointTime MenuId:(NSString *)menuid S_menu_id:(NSString *)smenuid Menu_content:(NSString *)menucontent block:(void (^)(id responseObject, NSError *error))block{
     NSDictionary * dic = [NSDictionary dictionaryWithObjectsAndKeys:uname,@"uname",securiycode,@"security_code",pointTime,@"v_point_time",menuid,@"menu_id",smenuid,@"s_menu_id",menucontent,@"menul_content",nil];
    [[LPShareManager shareManager]POST:url dict:dic succeed:^(id responseObject) {
        block(responseObject,nil);
    } failure:^(NSError *error) {
        block(nil,error);
    }];
}
//获取测评数据。
+(void)postGetQuestionUserName:(NSString *)userName securityCode:(NSString *)securiytcode url:(NSString *)url block:(void (^)(id responseObject, NSError *error))block{
    NSDictionary * dic = [NSDictionary dictionaryWithObjectsAndKeys:userName,@"uname",securiytcode,@"security_code",nil];
    [[LPShareManager shareManager]POST:url dict:dic succeed:^(id responseObject) {
        block(responseObject,nil);
    } failure:^(NSError *error) {
        block(nil,error);
    }];
    
}

+(void)posthttpSaveQuestionnaireJsonAnswer:(NSArray *)jsonAnswer block:(void (^)(id responseObject, NSError *error))block{
    
    
    
    NSDictionary * dic = [NSDictionary dictionaryWithObjectsAndKeys:
                          [LPCommonTool readUserDefaultObjectForKey:DSUSERKEY][@"phoneNumber"], @"uname",
                          [LPCommonTool readUserDefaultObjectForKey:DSUSERKEY][@"password"], @"security_code",jsonAnswer, @"jsonAnswer",nil];

    NSString * jsonString = [LPCommonTool objectToJsonWithObject:dic];
    NSDictionary *dictionary = [NSDictionary dictionaryWithObjectsAndKeys: jsonString, @"appJson", nil];
    
   
    
    [[LPShareManager shareManager]POST:SaveQuestionnaireApp dict:dictionary succeed:^(id responseObject) {
        block(responseObject,nil);
    } failure:^(NSError *error) {
        block(nil,error);
    }];
}




@end
